package datastructure;

import org.junit.Test;

public class day1_1 {
    public static boolean containDuplicate(int[] nums){
        quickSort(nums,0,nums.length-1);
        for (int i=0;i<nums.length-1;++i){
            if (nums[i]==nums[i+1]){

                return true;

            }
        }
        return false;
    }

    public static void quickSort(int[] nums,int _left,int _right){
        int left=_left;
        int right=_right;
        if(left<=right){
            int temp=nums[left];
            while (left!=right){
                while(right>left&&nums[right]>=temp)
                    right--;
                nums[left]=nums[right];
                while(left<right&&nums[left]<=temp)
                    left++;
                nums[right]=nums[left];
            }

            nums[right]=temp;
            quickSort(nums,_left,left-1);
            quickSort(nums,right+1,_right);
        }
    }
    @Test
    public void test(){
        int[] a =new int[6];
        System.out.println(a[0]);
        System.out.println(containDuplicate(new int[]{3,2,1,1,2,3}));

    }

}
